package com.scu.phototabuser.ui.navitems;

import android.app.DialogFragment;
import android.os.Bundle;
import android.support.annotation.IdRes;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.scu.phototabuser.R;

/**
 * Created by tianfei on 2017/5/12.
 */

public class GenerateDialogFragment extends DialogFragment {


    private int resID;

    public static GenerateDialogFragment newInstance(String title,@IdRes int resID){
        GenerateDialogFragment adf = new GenerateDialogFragment();
        adf.resID = resID;
        Bundle bundle = new Bundle();
        bundle.putString("title", title);
        adf.setArguments(bundle);
        return adf;
    }


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setCancelable(true);
        setStyle(STYLE_NORMAL,0);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View v=inflater.inflate(this.resID,container,false);

        getDialog().setTitle(getArguments().getString("title"));

        return v;
    }
}
